import 'package:duo_zui/Util/config_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:share/share.dart';
import 'package:webview_flutter/webview_flutter.dart';

import '../web_view_page.dart';

//文章详情界面
class WebViewPage extends StatefulWidget {
  String title;
  String url;
  var  actions;
  WebViewPage({
    Key key,
    @required this.title,
    @required this.url,
    @required this.actions,
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return new WebViewPageState();
  }
}

class WebViewPageState extends State<WebViewPage> {

  bool isLoad = true;

  double lineProgress = 0.0;

  @override
  void initState() {
    super.initState();
  }

  _progressBar(double progress, BuildContext context) {
    return Container(
      child: LinearProgressIndicator(
        backgroundColor: Colors.blueAccent.withOpacity(0),
        value: progress == 1.0 ? 0 : progress,
        valueColor: new AlwaysStoppedAnimation<Color>(Colors.lightBlue),
      ),
      height: 1,
    );
  }

  Container foot= Container(child:Text(""));
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: _buildAppBar(),
        body: WebView(
           initialUrl: widget.url,)
    );
  }

  // 顶部导航
  Widget _buildAppBar() {
    return transparentAppBar(
        context: context,
        leading: IconButton(
          icon: Icon(
            Icons.arrow_back,
            color: ConfigColor.primaryText,
          ),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        actions: <Widget>[
          IconButton(
            icon: Icon(
              Icons.bookmark_border,
              color: ConfigColor.primaryText,
            ),
            onPressed: () {},
          ),
          IconButton(
            icon: Icon(
              Icons.share,
              color: ConfigColor.primaryText,
            ),
            onPressed: () {
              Share.share('www.baidu.com');
            },
          ),
        ]);
  }
}